﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PBOffice.Models;
using PBOffice.BLL;

public partial class AppraisalManager_ManualSign : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            this.txtDate.Text = DateTime.Now.ToShortDateString();
            this.btnTui.Enabled = false;

        }

    }
    protected void btnDao_Click(object sender, EventArgs e)
    {
        this.Panel3.Visible = false;
        this.btnDao.Disabled = true;
        this.Panel2.Visible = true;
        this.btnTui.Enabled = true;   
        Staff name = (Staff)Session["username"];
         this.txtUserName.Text =name.StfName;
        this.txtUserDepartment.Text = name.Department.DeptName;
         this.txtUserID.Text = name.StfId.ToString();
        this.lblSignInTime.Text = DateTime.Now.ToString();
        this.txtSignMemo1.Text = this.txtMemo.Text;
        ManualSign sign = new ManualSign();
        sign.SignDesc = this.txtMemo.Text;
        sign.SignTag = 1;
        sign.SignTime = Convert.ToDateTime(this.lblSignInTime.Text);
        sign.User = name;
        new ManualSignManager().AddManualSign(sign);
    
    }
    protected void btnTui_Click(object sender, EventArgs e)
    {
        Staff name = (Staff)Session["username"];
        this.txtUserName2.Text = name.StfName;
        this.txtUserDepartment2.Text = name.Department.DeptName;
        this.txtUserID2.Text = name.StfCode;
        this.txtSignMemo2.Text = this.txtMemo.Text;
        this.lblSignOffTime.Text = DateTime.Now.ToString();
        this.txtUserAgency.Text = name.Department.Branch.BranchName;
        ManualSign sign = new ManualSign();
        sign.SignDesc = this.txtMemo.Text;
        sign.SignTag = 0;
        sign.SignTime = Convert.ToDateTime(this.lblSignOffTime.Text);
        sign.User = name;
        new ManualSignManager().AddManualSign(sign);
        this.btnTui.Enabled = false;
        this.Panel2.Visible = false;
        this.Panel3.Visible = true;
        this.btnDao.Disabled = false;
    }
}